 /*      SClassBoolean.cpp
 *
 *      Copyright 2009 virpool <virpool@ukrpost.ua>
 *
 *      This program is free software; you can redistribute it and/or modify
 *      it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation; either version 2 of the License, or
 *      (at your option) any later version.
 *
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU General Public License for more details.
 *
 *      You should have received a copy of the GNU General Public License
 *      along with this program; if not, write to the Free Software
 *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 *      MA 02110-1301, USA.
 */

#include "SClassBoolean.h"

SClassBoolean::SClassBoolean(string name) : SObject(name, "Boolean")
{
	// TODO Auto-generated constructor stub
	GetMethods()->erase("ToString");
	GetMethods()->insert(pair<string, s_func>("ToString", &SClassBoolean::ToString));

}

SClassBoolean::~SClassBoolean()
{
	// TODO Auto-generated destructor stub
}

int SClassBoolean::ToString(SObject* obj, s_param* res, param_list* args)
{
	if (obj == NULL || res == NULL)
	{
		return S_INVOKE_INCORRECT;
	}
	res->type = S_STRING;
	string *s = new string();
	(*s) = ((SClassBoolean*)obj)->Get() == true ? "true" : "false";
	res->val = s;
	return S_INVOKE_OK;
}
